/*
 * tilesetProperties.cpp
 *
 *  Created on: Aug 16, 2013
 *      Author: jason
 */

#include "../../include/Tileset/tilesetProperties.hpp"

namespace Tmx {
Properties::Properties() {
	std::cout << "Constructor\n";
	id = -1;
}

Properties::~Properties() {
//	propertiesMap.clear();
}

void Properties::parse(TiXmlNode *propertiesNode) {
	const TiXmlNode *propertyNode = propertiesNode->FirstChild("property");
	std::string propertyName;
	std::string propertyValue;
	while (propertyNode) {
		const TiXmlElement* propertyElement = propertyNode->ToElement();
		propertyName = propertyElement->Attribute("name");
		propertyValue = propertyElement->Attribute("value");
		id = 0;//atoi(propertyValue.c_str());
//		propertiesMap[value] = propertyName;
		std::cout << "Name " << propertyName << " value " << propertyValue << std::endl;
		propertyNode = propertiesNode->IterateChildren("property", propertyNode);
	}
}
//
//std::string Properties::getProperty(int key)
//{
//	// returns object's ID from hash table
//	std::unordered_map< int, std::string >::iterator iter = propertiesMap.find(key);
//	if (iter == propertiesMap.end()) {
//		return "Cannot find property\n";
//	}
//	return iter->second;
//}
}


